
*** OUTCOMES FROM UNFOLDING BRACKETS FOR AGE 55

use "Data/NCDS/UKDA-6137-stata9_se/stata9_se/ncds8_unfolding_brackets.dta", clear

local vars W F M Y O

* employed: take home (net) pay
foreach v of local vars{
replace N8CNP`v'MN=. if  N8CNP`v'MN<0
replace N8CNP`v'MX=. if  N8CNP`v'MX<0
}
egen npee_min=rowmax(N8CNP*MN)
egen npee_max=rowmax(N8CNP*MX)

* employed: gross pay
foreach v of local vars{
replace N8CGR`v'MN=. if  N8CGR`v'MN<0
replace N8CGR`v'MX=. if  N8CGR`v'MX<0
}
egen gpee_min=rowmax(N8CGR*MN)
egen gpee_max=rowmax(N8CGR*MX)

* self-employed: net profit last year
ge npse_min= N8SEPRMN if  N8SEPRMN!=. &  N8SEPRMN>=0
ge npse_max= N8SEPRMX if  N8SEPRMX!=. &  N8SEPRMX>=0

* self-employed: earnings last year
ge ese_min=N8SEERMN if N8SEERMN>=0
ge ese_max=N8SEERMX if N8SEERMX>=0

keep NCDSID  *_max *_min
sort NCDSID

save scratchdata/ncds_2008_unfolding.dta, replace


